package net.angrynut.web.handler.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.RequestHandledEvent;

@Component
@Slf4j
public class RequestHandlerListener {

	/**
	 * 监听事件 {@link RequestHandledEvent}，并设置监听条件。
	 */
	@EventListener(condition = "#event.statusCode != 200")
	@Async
	public void processBlackListEvent(RequestHandledEvent event) {
		log.info(RequestHandlerListener.class.getName() + ": " + event);
	}
}
